#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main()
{
    int fd = open("mypipe", O_RDONLY);
    if (fd == -1)
    {
        perror("open");
        exit(1);
    }
    while (1)
    {
        char buffer[1024];
        ssize_t n = read(fd, buffer, sizeof(buffer));
        if (n == -1)
        {
            perror("read");
            exit(1);
        }
        if (n == 0)
        {
            break;
        }
        buffer[n] = '\0';
        printf("ProcessB Received: %s\n", buffer);
    }

    close(fd);
    return 0;
}